/**
 */
package mvc_generator.mVCGenerator.impl;

import java.util.Collection;

import mvc_generator.mVCGenerator.MVCGeneratorPackage;
import mvc_generator.mVCGenerator.View;
import mvc_generator.mVCGenerator.WebSite;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Web Site</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link mvc_generator.mVCGenerator.impl.WebSiteImpl#getWebsiteName <em>Website Name</em>}</li>
 *   <li>{@link mvc_generator.mVCGenerator.impl.WebSiteImpl#getIndexViewName <em>Index View Name</em>}</li>
 *   <li>{@link mvc_generator.mVCGenerator.impl.WebSiteImpl#getViews <em>Views</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class WebSiteImpl extends ModelElementImpl implements WebSite
{
  /**
   * The default value of the '{@link #getWebsiteName() <em>Website Name</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getWebsiteName()
   * @generated
   * @ordered
   */
  protected static final String WEBSITE_NAME_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getWebsiteName() <em>Website Name</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getWebsiteName()
   * @generated
   * @ordered
   */
  protected String websiteName = WEBSITE_NAME_EDEFAULT;

  /**
   * The default value of the '{@link #getIndexViewName() <em>Index View Name</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getIndexViewName()
   * @generated
   * @ordered
   */
  protected static final String INDEX_VIEW_NAME_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getIndexViewName() <em>Index View Name</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getIndexViewName()
   * @generated
   * @ordered
   */
  protected String indexViewName = INDEX_VIEW_NAME_EDEFAULT;

  /**
   * The cached value of the '{@link #getViews() <em>Views</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getViews()
   * @generated
   * @ordered
   */
  protected EList<View> views;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected WebSiteImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return MVCGeneratorPackage.Literals.WEB_SITE;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getWebsiteName()
  {
    return websiteName;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setWebsiteName(String newWebsiteName)
  {
    String oldWebsiteName = websiteName;
    websiteName = newWebsiteName;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, MVCGeneratorPackage.WEB_SITE__WEBSITE_NAME, oldWebsiteName, websiteName));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getIndexViewName()
  {
    return indexViewName;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setIndexViewName(String newIndexViewName)
  {
    String oldIndexViewName = indexViewName;
    indexViewName = newIndexViewName;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, MVCGeneratorPackage.WEB_SITE__INDEX_VIEW_NAME, oldIndexViewName, indexViewName));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<View> getViews()
  {
    if (views == null)
    {
      views = new EObjectContainmentEList<View>(View.class, this, MVCGeneratorPackage.WEB_SITE__VIEWS);
    }
    return views;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case MVCGeneratorPackage.WEB_SITE__VIEWS:
        return ((InternalEList<?>)getViews()).basicRemove(otherEnd, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case MVCGeneratorPackage.WEB_SITE__WEBSITE_NAME:
        return getWebsiteName();
      case MVCGeneratorPackage.WEB_SITE__INDEX_VIEW_NAME:
        return getIndexViewName();
      case MVCGeneratorPackage.WEB_SITE__VIEWS:
        return getViews();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @SuppressWarnings("unchecked")
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case MVCGeneratorPackage.WEB_SITE__WEBSITE_NAME:
        setWebsiteName((String)newValue);
        return;
      case MVCGeneratorPackage.WEB_SITE__INDEX_VIEW_NAME:
        setIndexViewName((String)newValue);
        return;
      case MVCGeneratorPackage.WEB_SITE__VIEWS:
        getViews().clear();
        getViews().addAll((Collection<? extends View>)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case MVCGeneratorPackage.WEB_SITE__WEBSITE_NAME:
        setWebsiteName(WEBSITE_NAME_EDEFAULT);
        return;
      case MVCGeneratorPackage.WEB_SITE__INDEX_VIEW_NAME:
        setIndexViewName(INDEX_VIEW_NAME_EDEFAULT);
        return;
      case MVCGeneratorPackage.WEB_SITE__VIEWS:
        getViews().clear();
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case MVCGeneratorPackage.WEB_SITE__WEBSITE_NAME:
        return WEBSITE_NAME_EDEFAULT == null ? websiteName != null : !WEBSITE_NAME_EDEFAULT.equals(websiteName);
      case MVCGeneratorPackage.WEB_SITE__INDEX_VIEW_NAME:
        return INDEX_VIEW_NAME_EDEFAULT == null ? indexViewName != null : !INDEX_VIEW_NAME_EDEFAULT.equals(indexViewName);
      case MVCGeneratorPackage.WEB_SITE__VIEWS:
        return views != null && !views.isEmpty();
    }
    return super.eIsSet(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public String toString()
  {
    if (eIsProxy()) return super.toString();

    StringBuffer result = new StringBuffer(super.toString());
    result.append(" (websiteName: ");
    result.append(websiteName);
    result.append(", indexViewName: ");
    result.append(indexViewName);
    result.append(')');
    return result.toString();
  }

} //WebSiteImpl
